#Function 1: loads packages and installs if not already installed
package_load <- function(package_vector){
  #Collects a list of packages not installed
  not_installed <- package_vector[!(package_vector %in% installed.packages()[,"Package"])]
  
  #install if not already installed
  if(length(not_installed) > 0){
    for(i in 1:length(not_installed)){
      install.packages(not_installed[i], dependencies = TRUE)
    }}
  
  #load packages
  for(i in 1:length(package_vector)){
    require(package_vector[i], character.only = TRUE)}
  }



